
*	************************************************************************
* 	File-Name: 		EE_2013_Brazil_replication.do
*	Date:  			5 September 2013
*	Authors: 		Patrick Bayer, Christopher Marcoux, and Johannes Urpelainen
*	Journal:		Ecological Economics
* 	Paper:			Leveraging Private Capital for Climate Mitigation: Evidence from 
*					the Clean Development Mechanism
*
*	Data Used:  	RiskCDM.dta	
*	Purpose:   		.do file for replication
*	Software:		Stata IC 12.1
*	Machine:		WINDOWS 7
*
*	************************************************************************

clear all

* NB: Please place .do file and data in the same folder
use "./RiskCDM.dta"
set more off, permanently


*	************************************************************************
*	(I) MAIN TEXT
*	************************************************************************

*	************************************************************************
*	1. Main models
*	************************************************************************

eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)

*	************************************************************************
*	(II) APPENDIX
*	************************************************************************

*	************************************************************************
*	A4 -- Summary Statistics and Correlation Matrices (Tables A2-A3)
*	************************************************************************

*	************************************************************************
* 	Summary statistics
*	************************************************************************

* Full sample
eststo clear
quietly xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year, vce(cluster hostcountry)
estpost summarize loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp if e(sample)

* Unilateral sample
eststo clear
quietly xi: regress loginvestmentco2 intensity M3corrupt L2democ M3loggdp i.typenew i.year if unilat==1, vce(cluster hostcountry)
estpost summarize loginvestmentco2 intensity M3corrupt L2democ M3loggdp if e(sample)

* Bilateral sample
eststo clear
quietly xi: regress loginvestmentco2 intensity M3corrupt L2democ M3loggdp i.typenew i.year if unilat==0, vce(cluster hostcountry)
estpost summarize loginvestmentco2 intensity M3corrupt L2democ M3loggdp if e(sample)

*	************************************************************************
* 	Correlation matrices
*	************************************************************************

* Full sample
eststo clear
quietly xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year, vce(cluster hostcountry)
estpost correlate loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp if e(sample), matrix

* Unilateral sample
eststo clear
quietly xi: regress loginvestmentco2 intensity  M3corrupt L2democ M3loggdp i.typenew i.year if unilat==1, vce(cluster hostcountry)
estpost correlate loginvestmentco2 intensity M3corrupt L2democ M3loggdp if e(sample), matrix

* Bilateral sample
eststo clear
quietly xi: regress loginvestmentco2 intensity M3corrupt L2democ M3loggdp i.typenew i.year if unilat==0, vce(cluster hostcountry)
estpost correlate loginvestmentco2 intensity M3corrupt L2democ M3loggdp if e(sample), matrix

*	************************************************************************
*	A7 -- Robustness: Matching Analysis (Table A6)
*	************************************************************************

* See http://gking.harvard.edu/cem/ for implementation of CEM in Stata

imb intensity M3corrupt M3loggdp L2democ, treatment(unilat)
cem intensity M3corrupt M3loggdp L2democ, treatment(unilat) autocuts(sturges)

eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year [pweight = cem_weights], vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year [pweight = cem_weights], vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" [pweight = cem_weights], vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" [pweight = cem_weights], vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" [pweight = cem_weights], vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" [pweight = cem_weights], vce(cluster hostcountry)


*	************************************************************************
*	A8 -- Robustness: Extra Interaction Models (Tables A7-A11)
*	************************************************************************

* Unilateral x corruption interaction (Table A7)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt unilatXcorrupt i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt unilatXcorrupt L2democ M3loggdp i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt unilatXcorrupt i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt unilatXcorrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt unilatXcorrupt i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt unilatXcorrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)


* Unilateral x democracy interaction (Table A8)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity L2democ unilatXdemoc i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity L2democ unilatXdemoc M3corrupt M3loggdp i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity L2democ unilatXdemoc i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity L2democ unilatXdemoc M3corrupt M3loggdp i.typenew i.year  if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity L2democ unilatXdemoc i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity L2democ unilatXdemoc M3corrupt M3loggdp i.typenew i.year  if hostcountry !="India", vce(cluster hostcountry)

* Unilateral x GDP interaction (Table A9)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3loggdp unilatXgdp i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3loggdp unilatXgdp L2democ M3corrupt i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3loggdp unilatXgdp i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3loggdp unilatXgdp L2democ M3corrupt i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3loggdp unilatXgdp i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3loggdp unilatXgdp L2democ M3corrupt i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)


* Unilateral x project size interaction (Table A10)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity small unilatXsmall L2democ i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity small unilatXsmall L2democ M3corrupt M3loggdp i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity small unilatXsmall L2democ i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity small unilatXsmall L2democ M3corrupt M3loggdp i.typenew i.year  if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity small unilatXsmall L2democ i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity small unilatXsmall L2democ M3corrupt M3loggdp i.typenew i.year  if hostcountry !="India", vce(cluster hostcountry)

* Unilateral x CER2020 interaction (Table A11)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity cer2020 unilatXcer2020 i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity cer2020 unilatXcer2020 M3corrupt L2democ M3loggdp i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity cer2020 unilatXcer2020 i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity cer2020 unilatXcer2020 M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity cer2020 unilatXcer2020 i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity cer2020 unilatXcer2020 M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)



*	************************************************************************
*	A9 -- Robustness: Rejected and Terminated Projects (Tables A12-A13)
*	************************************************************************

* Rejected and terminated models are excluded (Table A12)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if status!="Validation terminated" & status!="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if status!="Validation terminated" & status!="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & status!="Validation terminated" & status!="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & status!="Validation terminated" & status!="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & status!="Validation terminated" & status!="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & status!="Validation terminated" & status!="Rejected", vce(cluster hostcountry)

* Models for only rejected and terminated projects (Table A13)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if status=="Validation terminated" | status=="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if status=="Validation terminated" | status=="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & status=="Validation terminated" | status=="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & status=="Validation terminated" | status=="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & status=="Validation terminated" | status=="Rejected", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & status=="Validation terminated" | status=="Rejected", vce(cluster hostcountry)


*	************************************************************************
*	A10 -- Robustness: Renewable Energy Projects (Tables A14-A20)
*	************************************************************************

* Models without hydroelectricity projects (Table A14)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if type != "Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if type != "Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & type != "Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & type != "Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & type != "Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & type != "Hydro", vce(cluster hostcountry)

* Models without wind projects (Table A15)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if type != "Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if type != "Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & type != "Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & type != "Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & type != "Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & type != "Wind", vce(cluster hostcountry)

* Model without biomass projects (Table A16)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if type != "Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if type != "Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & type != "Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & type != "Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & type != "Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & type != "Biomass energy", vce(cluster hostcountry)


* Models without solar projects (Table A17)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if type != "Solar", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if type != "Solar", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & type != "Solar", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & type != "Solar", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & type != "Solar", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & type != "Solar", vce(cluster hostcountry)


* Models for only hydroelectricity projects (Table A18)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.year if type=="Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.year if type=="Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.year if hostcountry !="China" & type=="Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.year if hostcountry !="China" & type=="Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.year if hostcountry !="India" & type=="Hydro", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.year if hostcountry !="India" & type=="Hydro", vce(cluster hostcountry)

* Models for only wind projects (Table A19)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.year if type=="Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.year if type=="Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.year if hostcountry !="China" & type=="Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.year if hostcountry !="China" & type=="Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.year if hostcountry !="India" & type=="Wind", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.year if hostcountry !="India" & type=="Wind", vce(cluster hostcountry)

* Models for only biomass projects (Table A20)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.year if type=="Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.year if type=="Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.year if hostcountry !="China" & type=="Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.year if hostcountry !="China" & type=="Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.year if hostcountry !="India" & type=="Biomass energy", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.year if hostcountry !="India" & type=="Biomass energy", vce(cluster hostcountry)


*	************************************************************************
*	A11 -- Robustness: Analysis of Other Project Types (Tables A21-A25)
*	************************************************************************

* Models without HFC and N20 projects (Table A21)
gen hfc=0
replace hfc=1 if typenew==7

eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hfc==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hfc==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & hfc==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & hfc==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & hfc==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & hfc==0, vce(cluster hostcountry)

* Models without methane avoidance projects (Table A22)
gen methane=0
replace methane=1 if type=="Methane avoidance"

eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if methane==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if methane==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & methane==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & methane==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & methane==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & methane==0, vce(cluster hostcountry)

* Models without energy efficiency projects (Table A23)
gen EE=0
replace EE=1 if typenew==3 | typenew==4

eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if EE==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if EE==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & EE==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & EE==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & EE==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & EE==0, vce(cluster hostcountry)


* Models for only methane avoidance projects (Table A24)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if methane==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if methane==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & methane==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & methane==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & methane==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & methane==1, vce(cluster hostcountry)


* Models for only energy efficiency projects (Table A25)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if EE==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if EE==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & EE==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & EE==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & EE==1, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & EE==1, vce(cluster hostcountry)

*	************************************************************************
*	A12 -- Robustness: Control for GDP Squared (Table A26)
*	************************************************************************

eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp M3loggdp2 i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp M3loggdp2 i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp M3loggdp2 i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)


*	************************************************************************
*	A13 -- Robustness: Disaggregated Project Type Fixed Effects (Table A27)
*	************************************************************************

eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.type i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.type i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.type i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.type i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.type i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.type i.year if hostcountry !="India", vce(cluster hostcountry)

*	************************************************************************
*	A14 -- Robustness: Political Economy Controls (Table A28)
*	************************************************************************

eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp M3pop M3InvestProfile M3trade M3industry M3infdigdp M3internet i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp M3pop M3InvestProfile M3trade M3industry M3infdigdp M3internet i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp M3pop M3InvestProfile M3trade M3industry M3infdigdp M3internet i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)

*	************************************************************************
*	A15 -- Robustness: Outlier Analysis (Tables A29-A30)
*	************************************************************************

quietly xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year

* Create variable for Cooks distance
predict d1, cooksd
gen outlier = 0
replace outlier = 1 if d1 > 4/3749

* Create variable for studentized residuals
predict r1, rstandard
gen absr1 = abs(r1)

* Cooks distance outliers (Table A29)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if outlier==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if outlier==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & outlier==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & outlier==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & outlier==0, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & outlier==0, vce(cluster hostcountry)


* Studentized residual outliers (Table A30)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if absr1 < 2, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if absr1 < 2, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & absr1 < 2, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & absr1 < 2, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & absr1 < 2, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & absr1 < 2, vce(cluster hostcountry)


*	************************************************************************
*	A16 -- Robustness: Regional Sensitivity (Tables A31-A36)
*	************************************************************************

* Exclude CDM projects from China and India (Table A31)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & hostcountry != "India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & hostcountry != "India", vce(cluster hostcountry)

* Exclude CDM projects from the Asian and Pacific region (Table A32)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if region != "Asia & Pacific", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if region != "Asia & Pacific", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & region != "Asia & Pacific", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & region != "Asia & Pacific", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & region != "Asia & Pacific", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & region != "Asia & Pacific", vce(cluster hostcountry)

* Exclude CDM projects from the Latin American region (Table A33)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if region != "Latin America", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if region != "Latin America", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & region != "Latin America", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & region != "Latin America", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & region != "Latin America", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & region != "Latin America", vce(cluster hostcountry)

* Exclude CDM projects from the African region (Table A34)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if region != "Africa", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if region != "Africa", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & region != "Africa", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & region != "Africa", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & region != "Africa", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & region != "Africa", vce(cluster hostcountry)

* Exclude CDM projects from the European and Central Asian region (Table A35)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if region != "Europe & Central Asia", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if region != "Europe & Central Asia", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & region != "Europe & Central Asia", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & region != "Europe & Central Asia", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & region != "Europe & Central Asia", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & region != "Europe & Central Asia", vce(cluster hostcountry)

* Exclude CDM projects from the Middle East region (Table A36)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if region != "Middle-East", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if region != "Middle-East", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="China" & region != "Middle-East", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China" & region != "Middle-East", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity i.typenew i.year if hostcountry !="India" & region != "Middle-East", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India" & region != "Middle-East", vce(cluster hostcountry)


*	************************************************************************
*	A17 -- Robustness: Cross-sectional Analysis (Tables A37-A38)
*	************************************************************************

* NB: Country-level analysis requires a different unit of analysis
* We collapse the data first and label variables accordingly
encode projid, gen(id)
sort id

collapse (first) region (mean) loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp (count) id, by(hostcountry)

* Create variable labels
label variable loginvestmentco2 ""
label variable unilat "Unilateral"
label variable intensity "CO2 Intensity (3yr moving)"
label variable unilatXintensity "Unilateral x CO2 Intensity"
label variable M3corrupt "Corruption (3yr moving)"
label variable L2democ "Democracy"
label variable M3loggdp "GDP (3yr moving)"

* Unweighted models (Table A37)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity, vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp, vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity if hostcountry !="China", vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp if hostcountry !="China", vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity if hostcountry !="India", vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp if hostcountry !="India", vce(robust)


* Weighted models (Table A38)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity [aweight=id], vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp [aweight=id], vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity if hostcountry !="China" [aweight=id], vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp if hostcountry !="China" [aweight=id], vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity if hostcountry !="India" [aweight=id], vce(robust)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3corrupt L2democ M3loggdp if hostcountry !="India" [aweight=id], vce(robust)


*	************************************************************************
*	A18 -- Robustness: Availability of Domestic Capital (Tables A39-A40)
*	************************************************************************

* NB: We restore the original dataset 
clear all
use "./RiskCDM.dta"

* Model with domestic savings rate (Table A39)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3savings i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3savings M3corrupt L2democ M3loggdp i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3savings i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3savings M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3savings i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3savings M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)

* Model with real interest rate (Table A40)
eststo clear
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3interest i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3interest M3corrupt L2democ M3loggdp i.typenew i.year, vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3interest i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3interest M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="China", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3interest i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)
eststo: xi: regress loginvestmentco2 unilat intensity unilatXintensity M3interest M3corrupt L2democ M3loggdp i.typenew i.year if hostcountry !="India", vce(cluster hostcountry)



